package com.sm.service;

import com.sm.dao.LikeDynamicMapper;
import com.sm.model.LikeDynamic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LikeDynamicService {

    @Autowired
    LikeDynamicMapper likeDynamicMapper;

    public int insertLikeDynamic(LikeDynamic likeDynamic){
        return likeDynamicMapper.insertLikeDynamic(likeDynamic);
    }

    public List<LikeDynamic> selectLikeDynamicById(Integer dynamicId){
        return likeDynamicMapper.selectLikeDynamicById(dynamicId);
    }


    public void deleteComment(Integer dynamicId){
         likeDynamicMapper.deleteComment(dynamicId);
    }

    /**
     * 根据用户id和动态id查询是否存在
     */
    public List<LikeDynamic> isExist(Integer dynamicId,Integer userId){
        return likeDynamicMapper.isExist(dynamicId, userId);
    }


    public List<LikeDynamic> selectLikeUserIds(Integer dynamicId) {
        return likeDynamicMapper.selectLikeUserIds(dynamicId);
    }

    public int deleteOne(Integer dynamicId, Integer userId) {
        return likeDynamicMapper.deleteOne(dynamicId,userId);
    }
}
